package org.lee.basic.algorithm;

/**
 * @author jackielee
 * @version 1.0
 * @description Completion
 * @date 2021/4/19
 */
public class Completion {
  public static void main(String[] args) {
    // 完数：6=1+2+3
    completion(1000);
  }

  private static void completion(int n) {
    for (int i = 1; i <= n; ++i) {
      int temp = 0;
      for (int j = 1; j < i / 2 + 1; ++j) { // 折半
        if (i % j == 0) {
          temp += j;
        }
      }
      if (temp == i) {
        System.out.println(i + " ");
      }
    }
  }
}
